package com.ip;

import com.graphics.ImageIdentity;
import java.awt.Graphics;
import java.awt.image.BufferedImage;
import javax.swing.JPanel;

/**
 *
 * @author Sajarwo Anggai
 */
public class TilePattern extends JPanel {

    private int position;
    private ImageIdentity imageIdentity;

    public TilePattern(ImageIdentity imageIdentity, int position) {
        this.imageIdentity = imageIdentity;
        this.position = position;
    }

    public BufferedImage getImage() {
        return (BufferedImage) imageIdentity.getImages().get(position);
    }

    @Override
    public void paint(Graphics g) {
        super.paint(g);
        g.drawImage(getImage(), 0, 0, this);
    }

    public ImageIdentity getImageIdentity() {
        return imageIdentity;
    }

    public int getPosition() {
        return position;
    }
}

